import { createApp } from 'vue';
import App from '@/App.vue';
import store from '@/store';
// element-plus组件
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';

// components
import Components from '@/components';

//global
import DataStore from '@/global/storage';
import utils from '@/global/utils';
import validate from '@/global/utils/validate';
import msg from '@/global/utils/msg';
import config from "./global/config";
import { formatTime } from './global/utils/filters';


const app = createApp(App);
const global = app.config.globalProperties;
const $ = require('jquery');

// 全局变量
global.$jq = $; // jquery
global.$storage = DataStore; // 本地储存
global.$utils = utils; // 公共函数
global.$validate = validate; // 正则验证
global.$msg = msg; // 消息提示
global.$config = config; // 本地配置
global.$formatTime = formatTime; // 时间过滤

const init = async () => {
    const module = await import('./router');
    const router = await module.default;
    app.use(router).use(store).use(ElementPlus, { size: 'default', zIndex: 3000 }).use(Components).mount('#app');
};

init();
